package com.utc.fjc.stylesheet;

import java.util.Map;

import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.widgets.FormToolkit;

import com.teamcenter.rac.kernel.TCPropertyDescriptor;
import com.teamcenter.rac.viewer.stylesheet.beans.TextfieldPropertyBean;
import com.utc.common.util.FJCIdUtils;

public class FJCNONERPDesignIdTextField extends TextfieldPropertyBean {

	private String nextNONERPId = "";

	public FJCNONERPDesignIdTextField(FormToolkit formtoolkit,
			Composite composite, boolean flag, Map<Object, Object> map) {
		super(formtoolkit, composite, flag, map);
	}

	public void load(TCPropertyDescriptor des) throws Exception {
		super.load(des);

		String valueToSend = null;

		this.nextNONERPId = FJCIdUtils.getNewNONERPDesignId();

		if (this.nextNONERPId != null) {
			valueToSend = nextNONERPId.toString().trim();
			des.setDefaultValue(valueToSend);
			getTextField().setEnabled(false);
		}
	}
}
